package com.colin.util.design.chain.base;

import com.colin.util.exception.BusiException;

public abstract class ChainTemplate {
    
    protected void handle(ChainDto chainDto) throws BusiException {
        dealChain(chainDto);
        addIndex(chainDto);
        nextChain(chainDto);
    }

    protected abstract void dealChain(ChainDto chainDto) throws BusiException ;

    private void addIndex(ChainDto chainDto) {
        chainDto.getRequest().addIndex();
    }

    protected abstract void nextChain(ChainDto chainDto) throws BusiException;

}
